// Created by plusminus on 00:02:58 - 03.10.2008
package org.andnav.osm.views.overlay;

import java.util.ArrayList;
import java.util.List;

import org.andnav.osm.util.GeoPoint;

import android.graphics.Path;

/**
 * Immutable class describing a GeoPoint with a Title and a Description.
 * @author Nicolas Gramlich
 *
 */
public class OpenStreetMapViewOverlayItem {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================
	
	public final String mTitle;
	public final String mDescription;
	//public final GeoPoint mGeoPoint;
	//joeng poi
	public final String mCategory;
	public final String mCity;
	public final String mPlaceID;
	public final List<GeoPoint> mGeoPointList;

	// ===========================================================
	// Constructors
	// ===========================================================
	
	/**
	 * @param aTitle this should be <b>singleLine</b> (no <code>'\n'</code> )
	 * @param aDescription a <b>multiLine</b> description ( <code>'\n'</code> possible)
	 * @param aGeoPoint
	 */
	public OpenStreetMapViewOverlayItem(final String ID, final String aTitle, final String aDescription, 
			final GeoPoint aGeoPoint) {
		this.mPlaceID = ID;
		this.mTitle = aTitle;
		this.mDescription = aDescription;
		this.mCategory = "Default";
		this.mCity = "Default";
		this.mGeoPointList = new ArrayList<GeoPoint>();
		this.mGeoPointList.add(aGeoPoint);
	}

	/**
	 * @param aTitle this should be <b>singleLine</b> (no <code>'\n'</code> )
	 * @param aDescription a <b>multiLine</b> description ( <code>'\n'</code> possible)
	 * @param aGeoPoint
	 * @param aCategory
	 *///joeng poi
	public OpenStreetMapViewOverlayItem(final String ID, final String aTitle, final String aDescription, 
			final GeoPoint aGeoPoint, final String aCategory) {
		this.mPlaceID = ID;
		this.mTitle = aTitle;
		this.mDescription = aDescription;
		this.mCategory = aCategory;
		this.mCity = "Default";
		this.mGeoPointList = new ArrayList<GeoPoint>();
		this.mGeoPointList.add(aGeoPoint);
	}
	
	/**
	 * @param aTitle this should be <b>singleLine</b> (no <code>'\n'</code> )
	 * @param aDescription a <b>multiLine</b> description ( <code>'\n'</code> possible)
	 * @param aGeoPoint
	 * @param aCategory
	 * @param aCity
	 *///joeng poi
	public OpenStreetMapViewOverlayItem(final String ID, final String aTitle, final String aDescription, 
			final GeoPoint aGeoPoint, final String aCategory, final String aCity) {
		this.mPlaceID = ID;
		this.mTitle = aTitle;
		this.mDescription = aDescription;
		this.mCategory = aCategory;
		this.mCity = aCity;
		this.mGeoPointList = new ArrayList<GeoPoint>();
		this.mGeoPointList.add(aGeoPoint);
	}
	
	/**
	 * @param aTitle this should be <b>singleLine</b> (no <code>'\n'</code> )
	 * @param aDescription a <b>multiLine</b> description ( <code>'\n'</code> possible)
	 * @param aGeoPoint
	 * @param aCategory
	 * @param aCity
	 *///joeng poi
	public OpenStreetMapViewOverlayItem(final String ID, final String aTitle, final String aDescription, 
			final ArrayList aGeoPointList, final String aCategory, final String aCity) {
		this.mPlaceID = ID;
		this.mTitle = aTitle;
		this.mDescription = aDescription;
		this.mCategory = aCategory;
		this.mCity = aCity;
		this.mGeoPointList = (List<GeoPoint>) aGeoPointList.clone() ;
	}
	
	private void setGeoPointList(String aGeoPointList,List<GeoPoint> mGeoPointList ){
		String[] sGeoPointList = aGeoPointList.split(",");
		Integer i = 0;
		do{
			mGeoPointList.add(new GeoPoint(Integer.parseInt(sGeoPointList[i]),
					Integer.parseInt(sGeoPointList[i++])));
			i=i+2;			
		}while (i<sGeoPointList.length);

	}
	// ===========================================================
	// Getter & Setter
	// ===========================================================

	// ===========================================================
	// Methods from SuperClass/Interfaces
	// ===========================================================

	// ===========================================================
	// Methods
	// ===========================================================

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}
